<?php
 $q=$_GET["q"];
$hint="";
if(strlen($q)>0&&$q!="0")
{
include_once ("../Login/databaseconnection.php");
require_once ("../Login/config.php");
$arr="";
$getque=mysql_query("SELECT DISTINCT(Lab_Id) FROM lab");
while ($row= mysql_fetch_array($getque))
{
$Name=$row['Lab_Id'];
$value=substr($Name,0,strlen($q));
if(strcasecmp($value,$q)==0){
if($arr=="")
{
$arr=$Name;
}
else
{
$arr=$arr.",".$Name;
}
}
}
 $array= explode(",",$arr);
for ($i = 0; $i <count($array); $i++) 
{
 $temp =$array[$i];
  if($temp!="")
  {
  $hint=$hint.'<li onClick="fill(\''.$temp.'\');">'.$temp.'</li>';
  }
  $j = $i;
  for ($k = 0; $k <count($array); $k++) 
  {
    if ($k != $j) {
      if ($temp == $array[$k]) 
	  {
        $array[$k]="";
      }
    }
  }
}
}
if($hint=="")
{
$response="No suggestions";
}
else
{
$response=$hint;
}
echo $response;
?>